package project.demo1.servlet;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebServlet;
import org.springframework.boot.web.servlet.ServletComponentScan;

import java.io.IOException;
@WebServlet("/my.do")
public class hello implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("init");
    }
    @Override
    public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
        System.out.println("service");
        String userName = req.getParameter("userName");
        String userPSW = req.getParameter("userPSW");
        System.out.println(userName);
        System.out.println(userPSW);
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().write("hello");
        resp.getWriter().write(userName+"<br/>");
        resp.getWriter().write(userPSW+"<br/>");
    }
    @Override
    public void destroy() {
        System.out.println("destroy");
    }
    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public String getServletInfo() {
        return "";
    }


}
